package com.onefinger.domain;

import java.io.Serializable;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;

import org.codehaus.jackson.map.annotate.JsonSerialize;

import com.onefinger.repository.IdJsonSerializer;

@Entity
public class Subcategory implements Serializable, Identificable, Cloneable {

	private static final long serialVersionUID = -4211433869527557595L;
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long id;
	private String name;
	private String shortDescription;
	private Integer showOrder;
	private String icon;
	@ManyToOne
	private Category category;
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public Integer getShowOrder() {
		return showOrder;
	}
	public void setShowOrder(Integer showOrder) {
		this.showOrder = showOrder;
	}
	public String getIcon() {
		return icon;
	}
	public void setIcon(String icon) {
		this.icon = icon;
	}
	@JsonSerialize(using=IdJsonSerializer.class)
	public Category getCategory() {
		return category;
	}
	public void setCategory(Category category) {
		this.category = category;
	}
	public String getShortDescription() {
		return shortDescription;
	}
	public void setShortDescription(String shortDescription) {
		this.shortDescription = shortDescription;
	}
	public Subcategory clone() {
		Subcategory clone = new Subcategory();
		clone.id = id;
		clone.name = name;
		clone.showOrder = showOrder;
		clone.shortDescription = shortDescription;
		clone.category = category.clone();
		return clone;
	}
	
}
